package cn.wrl.user.service;

import cn.wrl.user.pojo.Users;
import cn.wrl.user.pojo.bo.UserBO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient("foodie-user-service")
@RequestMapping("user-api")
public interface UsersService {

    /**
     * 判断用户名是否存在
     *
     * @param username
     * @return
     */
    @GetMapping("user/exists")
    boolean queryUsernameIsExist(@RequestParam("username") String username);

    /**
     * 创建用户
     *
     * @param userBO
     * @return
     */
    @PostMapping("user")
    Users createUser(@RequestBody UserBO userBO);

    /**
     * 检索用户名是否和密码匹配
     *
     * @param username
     * @param password
     * @return
     */
    @GetMapping("verify")
    Users queryUserForLogin(@RequestParam("username") String username,
                            @RequestParam("password") String password);

}
